Skip to content

Fix background update for sliding sync (find previous membership) (v2)#17632

Merged
erikjohnston merged 3 commits into
developfrom
erikj/ss_fix_bg_update
Aug 29, 2024
Merged

Fix background update for sliding sync (find previous membership) (v2)#17632
erikjohnston merged 3 commits into
developfrom
erikj/ss_fix_bg_update

Conversation

@erikjohnston

@erikjohnston erikjohnston commented Aug 29, 2024

Copy link
Copy Markdown
Member

This reverts commit ab414f2.

Introduced in #17512

@erikjohnston erikjohnston marked this pull request as ready for review August 29, 2024 16:20
@erikjohnston erikjohnston requested a review from a team as a code owner August 29, 2024 16:20
ORDER BY event_stream_ordering DESC
AND m.user_id = ?
AND e.stream_ordering < ?
ORDER BY e.stream_ordering DESC

@MadLittleMods MadLittleMods Aug 29, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For onlookers, see context in #17631 (comment)

Comment thread changelog.d/17632.misc Outdated
SELECT event_id, membership
FROM room_memberships
FROM room_memberships AS m
INNER JOIN events AS e USING (room_id, event_id)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double-checking that looking it up this way isn't slow vs just by (event_id)

The events table does have "events_room_stream" btree (room_id, stream_ordering) so I think this could work fast.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, empirically seems fast. Also helped by the fact these rooms should have very few events in them (generally just an invite then rejection)

@erikjohnston erikjohnston merged commit d844afd into develop Aug 29, 2024
@erikjohnston erikjohnston deleted the erikj/ss_fix_bg_update branch August 29, 2024 18:16
@MadLittleMods MadLittleMods changed the title Fix background update for sliding sync (find previous membership) Fix background update for sliding sync (find previous membership) (v2) Aug 29, 2024
erikjohnston added a commit that referenced this pull request Aug 30, 2024
Follow-up to #17631 and
#17632 to fix-up
#17599

---------

Co-authored-by: Eric Eastwood <eric.eastwood@beta.gouv.fr>
erikjohnston added a commit that referenced this pull request Sep 5, 2024
erikjohnston added a commit that referenced this pull request Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants